import request from '@/utils/request'

// 创建选择题
export function createSubjectChoices(data) {
  return request({
    url: '/exam/subject/addSubject',
    method: 'post',
    data: data
  })
}

// 更新选择题
export function updateSubjectChoices(data) {
  return request({
    url: '/exam/subject/updateSubject',
    method: 'put',
    data: data
  })
}

// 删除选择题
export function deleteSubjectChoices(id) {
  return request({
    url: '/exam/subject-choices/delete?id=' + id,
    method: 'delete'
  })
}

// 获得选择题
export function getSubjectChoices(id) {
  return request({
    url: '/exam/subject-choices/get?id=' + id,
    method: 'get'
  })
}

// 获得选择题分页
export function getSubjectChoicesPage(query) {
  return request({
    url: '/exam/subject-choices/page',
    method: 'get',
    params: query
  })
}

// 导出选择题 Excel
export function exportSubjectChoicesExcel(query) {
  return request({
    url: '/exam/subject-choices/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
 
// 获得题目详情
export function getSubject(id,type) {
  return request({
    url: '/exam/subject/' + id + '?type=' + type,
    method: 'get'
  })
}


// 下载题目导入模板
export function importTemplate() {
  return request({
    url: '/exam/subject/get-import-template',
    method: 'get',
    responseType: 'blob'
  })
}

// 导出选择题 Excel
export function exportSubject(query) {
  return request({
    url: '/exam/subject/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  })
}